package com.rg.lrgboot.task;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.rg.lrgboot.controller.socket.WebSocketServer;

@Component
public class FixedPrintTask {

	@Scheduled(cron = "0/3 * * * * *")
	public void work(){
		String message = "启动就执行的定时任务！--------每十秒执行一次"+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
		try {
			WebSocketServer.sendInfo(message,"10");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
